package com.sunny.wordstudy;

import android.app.Activity;
import android.app.AlertDialog.Builder;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.media.AudioManager;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.text.Html;
import android.util.DisplayMetrics;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Display;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.AbsoluteLayout;
import android.widget.AbsoluteLayout.LayoutParams;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import com.sunny.dict.MDict;
import com.sunny.wordstudy.lib.Stat;
import com.sunny.wordstudy.lib.Study;
import java.io.PrintStream;
import java.lang.reflect.Method;
import java.util.Locale;
import java.util.Timer;
import java.util.TimerTask;

public class StudyView extends Activity
  implements ah
{
  static final int[] D;
  ProgressBar A;
  final int B = 10000;
  final int C = 12;
  AdapterView.OnItemClickListener E = new bd(this);
  private boolean F = false;
  private bk G = null;
  private boolean H = true;
  private boolean I = false;
  private int J = 10000;
  private Timer K = new Timer(true);
  private final int L = 0;
  private final int M = 1;
  private TimerTask N = new aj(this);
  private Handler O = new au(this);
  private final int P = 0;
  private final int Q = 1;
  private final int R = 2;
  private final int S = 3;
  private final int T = 4;
  private final int U = 5;
  private final int V = 6;
  private final int W = 2;
  private View.OnClickListener X = new be(this);
  private View.OnClickListener Y = new bf(this);
  private View.OnClickListener Z = new bg(this);
  int a;
  private View.OnClickListener aa = new bh(this);
  long b = 0L;
  ProgressDialog c = null;
  Stat d = Stat.a();
  Study e = Study.a();
  AbsoluteLayout f;
  TextView g;
  TextView h;
  TextView i;
  TextView j;
  ScrollView k;
  LinearLayout l;
  ScrollView m;
  LinearLayout n;
  ScrollView o;
  LinearLayout p;
  TextView q;
  TextView r;
  TextView s;
  TextView t;
  ListView u;
  String[] v;
  Button w;
  Button x;
  Button y;
  Button z;

  static
  {
    int[] arrayOfInt = new int[12];
    arrayOfInt[0] = -16777216;
    arrayOfInt[1] = -16776961;
    arrayOfInt[2] = -16711681;
    arrayOfInt[3] = -12303292;
    arrayOfInt[4] = -7829368;
    arrayOfInt[5] = -16711936;
    arrayOfInt[6] = -3355444;
    arrayOfInt[7] = -65281;
    arrayOfInt[8] = -65536;
    arrayOfInt[9] = -1;
    arrayOfInt[11] = -256;
    D = arrayOfInt;
  }

  private static int a(String paramString, int paramInt)
  {
    int i1 = Integer.parseInt(paramString);
    if (i1 == 0)
      i1 = paramInt;
    return i1;
  }

  private static String a(String paramString1, String paramString2, String paramString3)
  {
    String str3;
    if (paramString1.length() == 0)
    {
      str3 = "";
      return str3;
    }
    String str1 = "";
    int i1;
    for (String str2 = paramString1; ; str2 = str2.substring(i1 + paramString2.length(), str2.length()))
    {
      do
      {
        if (str2.indexOf(paramString2) == -1)
          str3 = str1 + str2;
        i1 = str2.indexOf(paramString2);
      }
      while (i1 == str2.length());
      str1 = str1 + str2.substring(0, i1) + paramString3;
    }
  }

  private static int b(String paramString, int paramInt)
  {
    int i1 = Integer.parseInt(paramString);
    if (i1 == 0);
    for (i1 = paramInt; ; i1 = D[(i1 - 1)])
      do
        return i1;
      while ((i1 <= 0) || (i1 > 12));
  }

  private void f(int paramInt)
  {
    SharedPreferences localSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    if (paramInt == 0)
    {
      int i3 = localSharedPreferences.getInt("soundvolume", 11);
      if (i3 == 11)
        i3 = 5;
      this.e.a(i3, false);
    }
    while (true)
    {
      return;
      int i1 = paramInt + this.e.b();
      this.e.a(i1, true);
      int i2 = this.e.b();
      SharedPreferences.Editor localEditor = localSharedPreferences.edit();
      localEditor.putInt("soundvolume", i2);
      localEditor.commit();
    }
  }

  private void g()
  {
    TextView localTextView = this.g;
    localTextView.setSingleLine(true);
    StringBuilder localStringBuilder1 = new StringBuilder(String.valueOf(this.d.getStudyBookName())).append(" ");
    Resources localResources1 = getResources();
    Object[] arrayOfObject1 = new Object[2];
    arrayOfObject1[0] = Long.valueOf(this.b + this.d.getIntroduceNum());
    arrayOfObject1[1] = Long.valueOf(this.d.getBookWords());
    String str = localResources1.getString(2131099763, arrayOfObject1);
    long l1 = this.d.getTotalLearnedTime() + this.d.getSessionLearnedTime() / 60L;
    StringBuilder localStringBuilder2 = new StringBuilder(String.valueOf(str)).append(" ");
    Resources localResources2 = getResources();
    Object[] arrayOfObject2 = new Object[2];
    arrayOfObject2[0] = Long.valueOf(l1 / 60L);
    arrayOfObject2[1] = Long.valueOf(l1 % 60L);
    localTextView.setText(localResources2.getString(2131099762, arrayOfObject2));
  }

  private void h()
  {
    int i1;
    if ((this.e.getWordStatus() == 0) && ((((0xF & (int)this.d.getSessionType()) == 1) || ((0xF & (int)this.d.getSessionType()) == 2) || ((0xF & (int)this.d.getSessionType()) == 7) || ((0xF & (int)this.d.getSessionType()) == 6))))
    {
      i1 = 0;
      if (i1 >= this.d.getWordShowPos())
        switch (0xF & (byte)(int)this.d.getSessionType())
        {
        case 3:
        case 4:
        case 5:
        default:
          label74: this.v[i1] = String.valueOf(i1 + 1) + "." + this.d.getStudyWordMean();
          label181: if (i1 < 3)
            break label364;
          this.u.setAdapter(new ArrayAdapter(this, 17367043, this.v));
          this.u.setOnItemClickListener(this.E);
          this.u.setVisibility(0);
        case 1:
        case 6:
        case 2:
        case 7:
        }
    }
    while (true)
    {
      return;
      this.v[i1] = String.valueOf(i1 + 1) + "." + this.d.getChooseItem(i1);
      ++i1;
      break label74:
      this.v[i1] = String.valueOf(i1 + 1) + "." + this.d.getStudyWordMean();
      break label181:
      this.v[i1] = String.valueOf(i1 + 1) + "." + this.d.getStudyWord();
      break label181:
      label364: this.v[(i1 + 1)] = String.valueOf(i1 + 2) + "." + this.d.getChooseItem(i1);
      ++i1;
      break label181:
      this.u.setVisibility(4);
      if (((this.d.isTestMode()) && (this.e.isShowAns()) && (((this.d.getLastStudyStat() == 0L) || (this.d.getLastStudyStat() == 2L)))) || (this.d.isTestMode()) || (!(this.e.isShowAns())) || (this.d.getLastStudyStat() != 1L) || (this.e.getRecallStudy() != 1))
        continue;
    }
  }

  private void i()
  {
    bn localbn = new bn(this);
    if ((localbn.c() <= 0) || (this.d.getSessionLearnedTime() <= 300L))
      return;
    String str1 = this.d.getStudyBookName();
    String str2 = this.d.getSessionTime();
    if (str2.length() > 16)
      str2 = str2.substring(0, 16);
    int i1 = (int)(this.d.getSessionLearnedTime() / 60L);
    String str3 = getResources().getString(2131099926);
    Object[] arrayOfObject = new Object[3];
    arrayOfObject[0] = str1;
    arrayOfObject[1] = Integer.valueOf(i1);
    arrayOfObject[2] = str2;
    localbn.a(String.format(str3, arrayOfObject));
  }

  public final int a(int paramInt)
  {
    String str = "";
    switch (paramInt)
    {
    case 0:
    default:
      label32: if (str.equals(""))
        break label131;
      new AlertDialog.Builder(this).setIcon(2130837511).setTitle(getResources().getString(2131099910)).setCancelable(false).setMessage(str).setPositiveButton(getResources().getString(2131099786), new aq(this)).show();
    case 1:
    case 2:
    }
    while (true)
    {
      return 0;
      str = getResources().getString(2131099911);
      break label32:
      str = getResources().getString(2131099912);
      break label32:
      label131: this.e.SecondStep(0, "0");
    }
  }

  public final AudioManager a()
  {
    return ((AudioManager)getSystemService("audio"));
  }

  public final boolean a(String paramString)
  {
    this.I = false;
    AlertDialog.Builder localBuilder = new AlertDialog.Builder(this);
    localBuilder.setIcon(getResources().getDrawable(2130837511));
    localBuilder.setTitle(getResources().getString(2131099913));
    localBuilder.setMessage(paramString);
    EditText localEditText = new EditText(this);
    localBuilder.setView(localEditText);
    localBuilder.setPositiveButton(getResources().getString(2131099786), new ao(this, localEditText));
    localBuilder.setNegativeButton(getResources().getString(2131099787), new ap(this));
    localBuilder.show();
    return false;
  }

  public final int b(int paramInt)
  {
    String str;
    switch (paramInt)
    {
    default:
      str = "";
    case 0:
    case 1:
    }
    for (int i1 = 0; (i1 == 0) || (!(this.F)) || (!(this.d.isTestMode())); i1 = 1)
    {
      while (true)
      {
        Toast.makeText(this, str, 0).show();
        this.e.SecondStep(0, "0");
        label70: return 0;
        str = getResources().getString(2131099915);
        i1 = 0;
      }
      str = getResources().getString(2131099916);
    }
    if (!(str.equals("")))
      new AlertDialog.Builder(this).setIcon(2130837511).setTitle(getResources().getString(2131099914)).setCancelable(false).setMessage(str + "\n\n" + this.d.getStudyWord() + "\n\n" + this.d.getStudyWordMean()).setPositiveButton(getResources().getString(2131099786), new ar(this)).show();
    while (true)
    {
      break label70:
      this.e.SecondStep(0, "0");
    }
  }

  public final void b()
  {
    this.O.sendEmptyMessage(1);
  }

  public final int c(int paramInt)
  {
    SharedPreferences localSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    switch (paramInt)
    {
    default:
    case 1:
    case 3:
    case 2:
    }
    while (true)
    {
      return 0;
      new String();
      String str1 = getResources().getString(2131099909);
      Object[] arrayOfObject = new Object[3];
      arrayOfObject[0] = Long.valueOf(this.d.getTestOkNum() + this.d.getTestFailNum());
      arrayOfObject[1] = Long.valueOf(this.d.getTestOkNum());
      arrayOfObject[2] = Long.valueOf(this.d.getTestFailNum());
      String str2 = String.format(str1, arrayOfObject);
      new AlertDialog.Builder(this).setIcon(2130837511).setTitle(getResources().getString(2131099908)).setMessage(str2).setNegativeButton(getResources().getString(2131099787), new as(this)).setPositiveButton(getResources().getString(2131099786), new at(this)).show();
      continue;
      if (localSharedPreferences.getBoolean("confirmmarktoday", true))
        new AlertDialog.Builder(this).setIcon(2130837511).setTitle(getResources().getString(2131099922)).setCancelable(false).setMessage(getResources().getString(2131099923)).setNegativeButton(getResources().getString(2131099787), new av(this)).setPositiveButton(getResources().getString(2131099786), new aw(this)).show();
      this.e.DealKeyPress(120);
      continue;
      if (localSharedPreferences.getBoolean("confirmmarkforever", true))
        new AlertDialog.Builder(this).setIcon(2130837511).setTitle(getResources().getString(2131099919)).setCancelable(false).setMessage(getResources().getString(2131099920)).setNegativeButton(getResources().getString(2131099787), new ax(this)).setPositiveButton(getResources().getString(2131099786), new ay(this)).show();
      this.e.DealKeyPress(122);
    }
  }

  public final void c()
  {
    if (this.G == null)
      return;
    this.G.a(this.d.getStudyWord());
  }

  public final void d()
  {
    this.e.c();
  }

  public final void d(int paramInt)
  {
    if (paramInt == 1)
      if (this.d.getTotalLearnedTime() + this.d.getSessionLearnedTime() / 60L >= 20L);
    while (true)
    {
      return;
      if (this.c != null)
        continue;
      new AlertDialog.Builder(this).setIcon(2130837511).setTitle(getResources().getString(2131099904)).setCancelable(false).setMessage(getResources().getString(2131099905)).setPositiveButton(getResources().getString(2131099786), new az(this)).show();
      continue;
      if (((paramInt != 11) && (paramInt != 12) && (paramInt != 13)) || (this.c != null))
        continue;
      new AlertDialog.Builder(this).setIcon(2130837511).setTitle(getResources().getString(2131099906)).setCancelable(false).setMessage(getResources().getString(2131099907)).setPositiveButton(getResources().getString(2131099786), new ba(this)).show();
    }
  }

  public final int e(int paramInt)
  {
    if (this.c == null)
    {
      this.a = paramInt;
      this.c = new ProgressDialog(this);
      this.c.setTitle(getResources().getString(2131099825));
      this.c.setIcon(2130837511);
      switch (this.a)
      {
      default:
      case 1:
      case 3:
      case 2:
      }
    }
    while (true)
    {
      this.c.show();
      new bb(this).start();
      return 0;
      this.c.setMessage(getResources().getString(2131099836));
      continue;
      this.c.setMessage(getResources().getString(2131099835));
      this.c.setMessage(getResources().getString(2131099840));
    }
  }

  public final void e()
  {
    g();
    new String();
    String str1 = getResources().getString(2131099886);
    Object[] arrayOfObject1 = new Object[4];
    arrayOfObject1[0] = Long.valueOf(this.d.getWordLearnNum());
    arrayOfObject1[1] = Long.valueOf(this.d.getWordForgetNum());
    arrayOfObject1[2] = this.d.getWordRp();
    arrayOfObject1[3] = "%";
    String str2 = String.format(str1, arrayOfObject1);
    this.j.setText(str2);
    new String();
    String str3 = getResources().getString(2131099887);
    Object[] arrayOfObject2 = new Object[7];
    arrayOfObject2[0] = Long.valueOf(this.d.getAllWordOkNum());
    arrayOfObject2[1] = Long.valueOf(this.d.getAllStudiedNum());
    arrayOfObject2[2] = Long.valueOf(this.d.getBlockWordOkNum());
    arrayOfObject2[3] = Long.valueOf(this.d.getReviewNum());
    arrayOfObject2[4] = Long.valueOf(this.d.getIntroduceNum());
    arrayOfObject2[5] = Long.valueOf(this.d.getTestOkNum());
    arrayOfObject2[6] = Long.valueOf(this.d.getTestFailNum());
    String str4 = String.format(str3, arrayOfObject2);
    this.t.setText(str4);
    switch (this.e.getWordStatus())
    {
    default:
      if (!(this.e.isShowStatus()))
        h();
      if ((((!(this.d.isTestMode())) || (!(this.e.isShowAns())) || ((this.d.getLastStudyStat() != 0L) && (this.d.getLastStudyStat() != 2L)))) && (!(this.d.isTestMode())) && (this.e.isShowAns()) && (this.d.getLastStudyStat() == 1L))
        this.e.getRecallStudy();
      return;
    case 0:
      this.I = true;
      String str5 = this.d.getStudyWord();
      this.h.setText(str5);
      this.i.setText(this.d.getStudyWordVoice());
      this.q.setText(this.d.getStudyWordMean());
      this.k.setVisibility(4);
      String str6 = this.d.getStudyWordSample();
      String str7;
      Object localObject1;
      int i1;
      String str12;
      if (str6.length() == 0)
      {
        str7 = getResources().getString(2131099837);
        this.s.setText(Html.fromHtml(str7));
        this.o.setVisibility(4);
        String str8 = this.d.getStudyWordRel();
        if (str8.length() == 0)
          str8 = getResources().getString(2131099838);
        this.r.setText(str8);
        this.m.setVisibility(4);
        if (((0xF & this.d.getSessionType()) == 5L) || ((0xF & this.d.getSessionType()) == 7L) || ((0xF & this.d.getSessionType()) == 6L) || ((0xF & this.d.getSessionType()) == 8L) || ((0xF & this.d.getSessionType()) == 9L))
          this.h.setVisibility(4);
        if (((0xF & this.d.getSessionType()) != 2L) && ((0xF & this.d.getSessionType()) != 1L) && ((0xF & this.d.getSessionType()) != 7L) && ((0xF & this.d.getSessionType()) != 6L))
          break label1428;
        new String();
        String str9 = getResources().getString(2131099888);
        Object[] arrayOfObject3 = new Object[2];
        arrayOfObject3[0] = Long.valueOf(this.d.getTestOkNum());
        arrayOfObject3[1] = Long.valueOf(this.d.getTestFailNum());
        String str10 = String.format(str9, arrayOfObject3);
        this.t.setText(str10);
        if (((0xF & this.d.getSessionType()) == 2L) || ((0xF & this.d.getSessionType()) == 7L))
        {
          this.h.setText(this.d.getStudyWordMean());
          this.i.setVisibility(4);
        }
        localObject1 = "";
        i1 = 0;
        if (i1 < this.d.getWordShowPos())
          break label1161;
        switch (0xF & (byte)(int)this.d.getSessionType())
        {
        case 3:
        case 4:
        case 5:
        default:
          str12 = String.valueOf(i1 + 1) + "." + this.d.getStudyWordMean();
          if (((String)localObject1).length() <= 0);
        case 1:
        case 6:
        case 2:
        case 7:
        }
      }
      for (Object localObject2 = localObject1 + "\n" + str12; i1 >= 3; localObject2 = str12)
      {
        this.q.setText((CharSequence)localObject2);
        this.w.setText(getResources().getString(2131099889));
        this.w.setVisibility(0);
        this.x.setText(getResources().getString(2131099894));
        this.x.setVisibility(0);
        this.y.setText(getResources().getString(2131099898));
        this.y.setVisibility(0);
        this.z.setText(getResources().getString(2131099901));
        this.z.setVisibility(0);
        this.k.setVisibility(4);
        this.w.setVisibility(0);
        this.o.setVisibility(4);
        this.m.setVisibility(4);
        break label264:
        str7 = a(a(str6, str5, "<strong><font color=\"blue\">" + str5 + "</font></strong>"), "\n", "<br/>");
        break label453:
        String str11 = String.valueOf(i1 + 1) + "." + this.d.getChooseItem(i1);
        if (((String)localObject1).length() > 0);
        for (localObject1 = localObject1 + "\n" + str11; ; localObject1 = str11)
        {
          ++i1;
          break label824:
        }
        str12 = String.valueOf(i1 + 1) + "." + this.d.getStudyWordMean();
        break label930:
        str12 = String.valueOf(i1 + 1) + "." + this.d.getStudyWord();
        break label930:
      }
      String str13 = String.valueOf(i1 + 2) + "." + this.d.getChooseItem(i1);
      if (((String)localObject2).length() > 0);
      for (localObject2 = localObject2 + "\n" + str13; ; localObject2 = str13)
      {
        ++i1;
        break label966:
      }
      if (((0xF & this.d.getSessionType()) == 3L) || ((0xF & this.d.getSessionType()) == 4L))
      {
        if ((0xF & this.d.getSessionType()) == 3L)
        {
          this.h.setText(this.d.getStudyWordMean());
          this.i.setVisibility(4);
        }
        this.w.setText(getResources().getString(2131099890));
      }
      while (true)
      {
        this.x.setVisibility(0);
        this.x.setText(getResources().getString(2131099895));
        this.z.setText(getResources().getString(2131099902));
        this.z.setVisibility(4);
        this.k.setVisibility(4);
        break label1089:
        this.w.setText(getResources().getString(2131099891));
        this.y.setText(getResources().getString(2131099900));
        this.y.setVisibility(0);
      }
    case 1:
      label264: label453: label966: this.I = false;
      label824: label1089: this.h.setText(this.d.getStudyWord());
      label930: this.h.setVisibility(0);
      label1161: label1428: this.i.setVisibility(0);
      this.k.setVisibility(4);
      this.q.setText(this.d.getStudyWordMean());
      if (this.e.isShowSample())
      {
        this.k.setVisibility(4);
        this.o.setVisibility(0);
        this.m.setVisibility(4);
        label1718: this.w.setText(getResources().getString(2131099893));
        this.x.setText(getResources().getString(2131099896));
        if (!(this.e.isShowRel()))
          break label1889;
        this.y.setText(getResources().getString(2131099903));
        label1779: this.y.setVisibility(0);
        if (!(this.e.isShowSample()))
          break label1909;
        this.z.setText(getResources().getString(2131099903));
      }
      while (true)
      {
        this.z.setVisibility(0);
        break label264:
        if (this.e.isShowRel())
        {
          this.k.setVisibility(4);
          this.o.setVisibility(4);
          this.m.setVisibility(0);
        }
        this.k.setVisibility(0);
        this.o.setVisibility(4);
        this.m.setVisibility(4);
        break label1718:
        label1889: this.y.setText(getResources().getString(2131099899));
        break label1779:
        label1909: this.z.setText(getResources().getString(2131099902));
      }
    case 2:
    }
    this.I = false;
    this.h.setText(this.d.getStudyWord());
    this.h.setVisibility(0);
    this.i.setVisibility(0);
    this.k.setVisibility(0);
    this.q.setText(this.d.getStudyWordMean());
    if (this.e.isShowSample())
    {
      this.k.setVisibility(4);
      this.o.setVisibility(0);
      this.m.setVisibility(4);
      label2020: this.w.setText(getResources().getString(2131099892));
      this.x.setText(getResources().getString(2131099897));
      if (!(this.e.isShowRel()))
        break label2191;
      this.y.setText(getResources().getString(2131099903));
      label2081: this.y.setVisibility(0);
      if (!(this.e.isShowSample()))
        break label2211;
      this.z.setText(getResources().getString(2131099903));
    }
    while (true)
    {
      this.z.setVisibility(0);
      break label264:
      if (this.e.isShowRel())
      {
        this.k.setVisibility(4);
        this.o.setVisibility(4);
        this.m.setVisibility(0);
      }
      this.k.setVisibility(0);
      this.o.setVisibility(4);
      this.m.setVisibility(4);
      break label2020:
      label2191: this.y.setText(getResources().getString(2131099899));
      break label2081:
      label2211: this.z.setText(getResources().getString(2131099902));
    }
  }

  public final void f()
  {
    if (this.c != null);
    try
    {
      this.c.dismiss();
      this.c = null;
      return;
    }
    catch (Exception localException)
    {
    }
  }

  protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    super.onActivityResult(paramInt1, paramInt2, paramIntent);
    this.e.a(this);
    this.e.a(this);
    MDict.setMddsWithDictID(-1);
  }

  public boolean onContextItemSelected(MenuItem paramMenuItem)
  {
    return onOptionsItemSelected(paramMenuItem);
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903048);
    this.e.a(this);
    this.e.a(this);
    MDict.setMddsWithDictID(-1);
    String[] arrayOfString = new String[4];
    arrayOfString[0] = "1";
    arrayOfString[1] = "2";
    arrayOfString[2] = "3";
    arrayOfString[3] = "4";
    this.v = arrayOfString;
    SharedPreferences localSharedPreferences1 = PreferenceManager.getDefaultSharedPreferences(this);
    int i1 = a(localSharedPreferences1.getString("wordlines", "1"), 1);
    this.f = ((AbsoluteLayout)findViewById(2131230768));
    DisplayMetrics localDisplayMetrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
    int i2 = localDisplayMetrics.widthPixels;
    int i3 = localDisplayMetrics.heightPixels - Math.round(52.0F * getResources().getDisplayMetrics().density);
    this.w = ((Button)findViewById(2131230771));
    this.x = ((Button)findViewById(2131230772));
    this.y = ((Button)findViewById(2131230773));
    this.z = ((Button)findViewById(2131230774));
    this.w.setOnClickListener(this.X);
    this.x.setOnClickListener(this.Y);
    this.y.setOnClickListener(this.Z);
    this.z.setOnClickListener(this.aa);
    this.A = ((ProgressBar)findViewById(2131230769));
    AbsoluteLayout.LayoutParams localLayoutParams1 = new AbsoluteLayout.LayoutParams(localDisplayMetrics.widthPixels, i3, 0, 0);
    this.g = new TextView(this);
    int i4 = 3 + Math.round(this.g.getTextSize());
    AbsoluteLayout.LayoutParams localLayoutParams2 = new AbsoluteLayout.LayoutParams(i2, i4, 0, 0);
    this.g.setSingleLine(true);
    this.g.setGravity(17);
    this.f.addView(this.g, localLayoutParams2);
    this.h = new TextView(this);
    this.h.setTextSize(a(localSharedPreferences1.getString("wordfontsize", "28"), 28));
    int i5 = b(localSharedPreferences1.getString("wordfontcolor", "0"), -16776961);
    if (i5 != -1)
      this.h.setTextColor(i5);
    this.i = new TextView(this);
    this.i.setTextSize(a(localSharedPreferences1.getString("wordvoicefontsize", "18"), 18));
    int i6 = b(localSharedPreferences1.getString("wordvoicefontcolor", "0"), -16711681);
    if (i6 != -1)
      this.i.setTextColor(i6);
    this.j = new TextView(this);
    this.q = new TextView(this);
    this.q.setTextSize(a(localSharedPreferences1.getString("wordmeanfontsize", "24"), 24));
    int i7 = b(localSharedPreferences1.getString("wordmeanfontcolor", "0"), -16711936);
    if (i7 != -1)
      this.q.setTextColor(i7);
    this.r = new TextView(this);
    this.r.setTextSize(a(localSharedPreferences1.getString("wordsamplefontsize", "18"), 18));
    int i8 = b(localSharedPreferences1.getString("wordsamplefontcolor", "-1"), -1);
    if (i8 != -1)
      this.r.setTextColor(i8);
    this.s = new TextView(this);
    this.s.setTextSize(a(localSharedPreferences1.getString("wordsamplefontsize", "18"), 18));
    int i9 = b(localSharedPreferences1.getString("wordsamplefontcolor", "-1"), -1);
    if (i9 != -1)
      this.s.setTextColor(i9);
    this.u = new ListView(this);
    this.t = new TextView(this);
    int i10 = i4 + 0;
    int i11 = 2 + Math.round(this.h.getTextSize());
    int i12 = 2 + Math.round(this.i.getTextSize());
    int i13 = 1 + Math.round(this.j.getTextSize());
    int i14 = 1 + Math.round(this.t.getTextSize());
    int i15 = i1 * i11 + i11 / 4;
    Math.round(this.w.getTextSize());
    int i16 = 4 + this.w.getLineHeight() + this.w.getPaddingBottom() + this.w.getPaddingTop();
    int i17 = (localLayoutParams1.width - 20) / 4;
    AbsoluteLayout.LayoutParams localLayoutParams3 = new AbsoluteLayout.LayoutParams(localLayoutParams1);
    localLayoutParams3.x = (5 + localLayoutParams3.x);
    localLayoutParams3.width -= 5;
    localLayoutParams3.y = (i10 + localLayoutParams3.y);
    localLayoutParams3.height = (i15 + 3);
    this.f.addView(this.h, localLayoutParams3);
    int i18 = i10 + i15 + 3;
    AbsoluteLayout.LayoutParams localLayoutParams4 = new AbsoluteLayout.LayoutParams(localLayoutParams1);
    localLayoutParams4.x = (5 + localLayoutParams4.x);
    localLayoutParams4.width -= 5;
    localLayoutParams4.y = (i18 + localLayoutParams4.y);
    localLayoutParams4.height = i12;
    this.f.addView(this.i, localLayoutParams4);
    int i19 = i18 + i12;
    AbsoluteLayout.LayoutParams localLayoutParams5 = new AbsoluteLayout.LayoutParams(localLayoutParams1);
    localLayoutParams5.y += i19 - i12 - i15;
    localLayoutParams5.x = (localLayoutParams5.width - 70);
    localLayoutParams5.width = 70;
    localLayoutParams5.height = (2 + i13 * 2);
    this.f.addView(this.j, localLayoutParams5);
    AbsoluteLayout.LayoutParams localLayoutParams6 = new AbsoluteLayout.LayoutParams(localLayoutParams1);
    localLayoutParams6.x = (5 + localLayoutParams6.x);
    localLayoutParams6.width -= 10;
    localLayoutParams6.y = (i3 - i16 - i14 - 10);
    localLayoutParams6.height = (i14 + 5);
    this.t = ((TextView)findViewById(2131230775));
    AbsoluteLayout.LayoutParams localLayoutParams7 = new AbsoluteLayout.LayoutParams(localLayoutParams1);
    localLayoutParams7.y = (i19 + localLayoutParams7.y);
    localLayoutParams7.x = (5 + localLayoutParams7.x);
    localLayoutParams7.height = (i3 - i19 - i16 - 10 - i14);
    localLayoutParams7.width -= 15;
    LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(-1, -2);
    this.k = new ScrollView(this);
    this.m = new ScrollView(this);
    this.o = new ScrollView(this);
    this.k.setVerticalScrollBarEnabled(true);
    this.m.setVerticalScrollBarEnabled(true);
    this.o.setVerticalScrollBarEnabled(true);
    this.l = new LinearLayout(this);
    this.l.setOrientation(1);
    this.k.addView(this.l);
    this.l.addView(this.q, localLayoutParams);
    this.n = new LinearLayout(this);
    this.n.setOrientation(1);
    this.m.addView(this.n);
    this.n.addView(this.r, localLayoutParams);
    this.p = new LinearLayout(this);
    this.p.setOrientation(1);
    this.o.addView(this.p);
    this.p.addView(this.s, localLayoutParams);
    this.f.addView(this.k, localLayoutParams7);
    this.f.addView(this.m, localLayoutParams7);
    this.f.addView(this.o, localLayoutParams7);
    this.f.addView(this.u, localLayoutParams7);
    this.f = ((AbsoluteLayout)findViewById(2131230770));
    AbsoluteLayout.LayoutParams localLayoutParams8 = new AbsoluteLayout.LayoutParams(localLayoutParams1);
    localLayoutParams8.x = 5;
    localLayoutParams8.y = 0;
    localLayoutParams8.width = i17;
    localLayoutParams8.height = i16;
    this.f.updateViewLayout(this.w, localLayoutParams8);
    AbsoluteLayout.LayoutParams localLayoutParams9 = new AbsoluteLayout.LayoutParams(localLayoutParams8);
    localLayoutParams9.x = (i17 + 8);
    localLayoutParams9.y = localLayoutParams8.y;
    this.f.updateViewLayout(this.x, localLayoutParams9);
    AbsoluteLayout.LayoutParams localLayoutParams10 = new AbsoluteLayout.LayoutParams(localLayoutParams8);
    localLayoutParams10.x = (11 + i17 * 2);
    localLayoutParams10.y = localLayoutParams8.y;
    this.f.updateViewLayout(this.y, localLayoutParams10);
    AbsoluteLayout.LayoutParams localLayoutParams11 = new AbsoluteLayout.LayoutParams(localLayoutParams8);
    localLayoutParams11.x = (14 + i17 * 3);
    localLayoutParams11.y = localLayoutParams8.y;
    this.f.updateViewLayout(this.z, localLayoutParams11);
    this.A.setProgress(100);
    this.A.setSecondaryProgress(100);
    registerForContextMenu(this.h);
    registerForContextMenu(this.q);
    registerForContextMenu(this.r);
    registerForContextMenu(this.s);
    if (this.d.getStudyLang().equals("en"))
    {
      Typeface localTypeface = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/WSEnVoice.ttf");
      this.i.setTypeface(localTypeface);
    }
    this.b = this.d.getTotalIntroducedWords();
    g();
    SharedPreferences localSharedPreferences2;
    String str2;
    label1860: label1879: label1898: String str3;
    try
    {
      localSharedPreferences2 = PreferenceManager.getDefaultSharedPreferences(this);
      f(0);
      str2 = localSharedPreferences2.getString("autosound", "0");
      if (str2.equals("0"))
      {
        this.e.setAutoSound(0);
        if (!(localSharedPreferences2.getBoolean("choosefailstop", false)))
          break label2287;
        this.F = true;
        if (!(localSharedPreferences2.getBoolean("autocountdown", true)))
          break label2295;
        this.H = true;
        if (!(localSharedPreferences2.getBoolean("recallstudymode", false)))
          break label2303;
        this.e.setRecallStudy(1);
        label1920: if (!(localSharedPreferences2.getBoolean("showwordhint", true)))
          break label2314;
        this.j.setVisibility(0);
        label2314: label2062: label1942: label2358: label2009: label2149: label2287: label2295: label2303: str3 = localSharedPreferences2.getString("firstwordorder", "0");
      }
    }
    catch (Exception localException3)
    {
      int i20;
      String str4;
      try
      {
        int i23 = Integer.valueOf(str3).intValue();
        i20 = i23;
        this.d.setUseRandomWord(i20);
        str4 = localSharedPreferences2.getString("newwordappearrole", "0");
      }
      catch (Exception localException3)
      {
        int i21;
        try
        {
          int i22 = Integer.valueOf(str4).intValue();
          i21 = i22;
          this.d.setStudyNewWordAppearRole(i21);
          String str1;
          Locale localLocale1;
          if (localSharedPreferences2.getBoolean("lastlearnmode", true))
          {
            setTitle(2131099758);
            this.e.BeginSession(Integer.parseInt(localSharedPreferences2.getString("studymode", "0")));
            e();
            if (Stat.b > 0)
            {
              System.err.println("!!!!Begin TTS Create: Have TTS Installed");
              new Locale("EN");
              str1 = this.d.getStudyLang().toLowerCase();
              System.err.println("TTS study db lang " + str1);
              localLocale1 = Locale.US;
              if (!(str1.equals("en")))
                break label2358;
            }
          }
          for (Locale localLocale2 = Locale.US; ; localLocale2 = localLocale1)
          {
            System.err.println("TTS use local " + localLocale2.toString());
            if ((0x1 & Stat.b) == 1)
            {
              System.err.println("!!!!Use TTS Extended Service");
              this.G = new bl(this, localLocale2);
            }
            while (true)
            {
              this.K.schedule(this.N, 1000L, 1000L);
              return;
              if (str2.equals("1"))
              {
                this.e.setAutoSound(1);
                break label1860:
                localException1 = localException1;
                this.s.setText(localException1.getMessage());
              }
              if (str2.equals("2"));
              this.e.setAutoSound(2);
              break label1860:
              this.F = false;
              break label1879:
              this.H = false;
              break label1898:
              this.e.setRecallStudy(0);
              break label1920:
              this.j.setVisibility(4);
              break label1942:
              setTitle(2131099788);
              this.e.BeginSession(Integer.parseInt(localSharedPreferences2.getString("testmode", "17")));
              break label2062:
              if (str1.equals("fr"))
                localLocale2 = Locale.FRENCH;
              if (str1.equals("de"))
                localLocale2 = Locale.GERMAN;
              if (str1.equals("es"))
                localLocale2 = new Locale("es");
              if (str1.equals("jp"))
                localLocale2 = Locale.JAPAN;
              if (str1.equals("kr"))
                localLocale2 = Locale.KOREAN;
              if (!(str1.equals("it")))
                break;
              localLocale2 = Locale.ITALIAN;
              break label2149:
              System.err.println("!!!!Use Default Google TTS Engine");
              try
              {
                Class localClass = getClassLoader().loadClass("com.sunny.wordstudy.TTSGoogle");
                Class[] arrayOfClass = new Class[2];
                arrayOfClass[0] = Context.class;
                arrayOfClass[1] = Locale.class;
                Method localMethod = localClass.getMethod("getGoogleTTS", arrayOfClass);
                Object[] arrayOfObject = new Object[2];
                arrayOfObject[0] = this;
                arrayOfObject[1] = localLocale2;
                this.G = ((bk)localMethod.invoke(null, arrayOfObject));
              }
              catch (Exception localException2)
              {
                localException2.printStackTrace();
              }
            }
          }
          localException3 = localException3;
          i20 = 0;
        }
        catch (Exception localException4)
        {
          i21 = 0;
          break label2009:
        }
      }
    }
  }

  public void onCreateContextMenu(ContextMenu paramContextMenu, View paramView, ContextMenu.ContextMenuInfo paramContextMenuInfo)
  {
    super.onCreateContextMenu(paramContextMenu, paramView, paramContextMenuInfo);
    paramContextMenu.add(0, 3, 3, getResources().getString(2131099881));
    paramContextMenu.add(0, 1, 1, getResources().getString(2131099880));
    paramContextMenu.add(0, 2, 2, getResources().getString(2131099879));
    paramContextMenu.add(0, 4, 4, getResources().getString(2131099882));
  }

  public boolean onCreateOptionsMenu(Menu paramMenu)
  {
    super.onCreateOptionsMenu(paramMenu);
    paramMenu.add(0, 1, 1, getResources().getString(2131099880));
    paramMenu.add(0, 2, 2, getResources().getString(2131099879));
    paramMenu.add(0, 4, 4, getResources().getString(2131099882));
    paramMenu.add(0, 5, 5, getResources().getString(2131099883));
    paramMenu.add(0, 0, 0, getResources().getString(2131099884));
    paramMenu.add(0, 6, 6, getResources().getString(2131099885));
    return true;
  }

  protected void onDestroy()
  {
    if (this.G != null)
      this.G.a();
    super.onDestroy();
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    if (paramInt == 4)
    {
      i();
      this.e.EndSession();
    }
    for (boolean bool = true; ; bool = super.onKeyDown(paramInt, paramKeyEvent))
      while (true)
      {
        return bool;
        if (paramInt == 24)
        {
          f(1);
          bool = true;
        }
        if (paramInt != 25)
          break;
        f(-1);
        bool = true;
      }
  }

  public boolean onOptionsItemSelected(MenuItem paramMenuItem)
  {
    switch (paramMenuItem.getItemId())
    {
    default:
    case 2:
    case 1:
    case 3:
    case 4:
    case 5:
    case 0:
    case 6:
    }
    while (true)
    {
      label48: return true;
      if (this.e.getWordStatus() == 0)
        new AlertDialog.Builder(this).setIcon(2130837511).setTitle(getResources().getString(2131099919)).setCancelable(false).setMessage(getResources().getString(2131099921)).setPositiveButton(getResources().getString(2131099786), new bi(this)).show();
      this.e.DealKeyPress(57);
      continue;
      if (this.e.getWordStatus() == 0)
        new AlertDialog.Builder(this).setIcon(2130837511).setTitle(getResources().getString(2131099922)).setCancelable(false).setMessage(getResources().getString(2131099924)).setPositiveButton(getResources().getString(2131099786), new bj(this)).show();
      this.e.DealKeyPress(97);
      continue;
      this.e.DealKeyPress(118);
      continue;
      if (this.e.isShowAns())
      {
        if ((this.d.isLoadedDict()) || (MDict.getDictCount() > 0))
        {
          Intent localIntent = new Intent(this, DictView.class);
          localIntent.putExtra("word", this.h.getText());
          startActivityForResult(localIntent, 2);
        }
        AlertDialog.Builder localBuilder2 = new AlertDialog.Builder(this);
        localBuilder2.setIcon(getResources().getDrawable(2130837511));
        localBuilder2.setTitle(getResources().getString(2131099826));
        localBuilder2.setMessage(getResources().getString(2131099839));
        localBuilder2.setPositiveButton(getResources().getString(2131099786), new ak(this));
        localBuilder2.show();
      }
      AlertDialog.Builder localBuilder1 = new AlertDialog.Builder(this);
      localBuilder1.setIcon(getResources().getDrawable(2130837511));
      localBuilder1.setTitle(getResources().getString(2131099826));
      localBuilder1.setMessage(getResources().getString(2131099925));
      localBuilder1.setPositiveButton(getResources().getString(2131099786), new al(this));
      localBuilder1.show();
      continue;
      startActivity(new Intent(this, StudyStatusView.class));
      continue;
      SharedPreferences localSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
      boolean bool1 = localSharedPreferences.getBoolean("showwordhint", true);
      SharedPreferences.Editor localEditor = localSharedPreferences.edit();
      if (bool1);
      for (boolean bool2 = false; ; bool2 = true)
      {
        localEditor.putBoolean("showwordhint", bool2);
        localEditor.commit();
        if (bool1)
          break;
        this.j.setVisibility(0);
        break label48:
      }
      this.j.setVisibility(4);
      continue;
      new AlertDialog.Builder(this).setTitle(getResources().getString(2131099917)).setMessage(getResources().getString(2131099918)).setPositiveButton(getResources().getString(2131099786), new am(this)).setNegativeButton(getResources().getString(2131099787), new an(this)).show();
    }
  }
}

/* Location:           E:\Desktop\Android\wordstd\classes_dex2jar.jar
 * Qualified Name:     com.sunny.wordstudy.StudyView
 * JD-Core Version:    0.5.3
 */